<template>
	<view class="visit">
		
		<view class="add_item" >
			<checkbox value="选择" :checked="checked" @click="checkBox($event)" />
			<view>是否签到</view>
		</view>
		
		<view class="add_textarea">
			<view>拜访说明</view>
			<textarea placeholder="请输入拜访内容" v-model="desc"/>
		</view>
		
		
		<view class="bottom_btn">
			<view class="bottom_btn_list">
				<view @tap="visitBth">拜访签到</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				desc: "",
				checked: false,
				id: ""
			}
		},
		onLoad(options) {
			console.log(options)
			this.id = options.id
		},
		methods:{
			checkBox(e){ //签到
				this.checked = !this.checked;
			},
			
			getAddr(e){
				console.log(e)
				let that = this;
				this.desc = e.detail.value;
				
			},
			
			visitBth(){
				let that = this;
				if(that.checked == false){
					uni.showToast({
						title: "请勾选拜访按钮",
						icon:"none"
					})
				}else if (that.desc.length < 1){
					uni.showToast({
						title:"请添加拜访说明",
						icon:"none"
					})
				}else{
					this.$api.getVisitSign({id: that.id, desc: this.desc})
				}
				
			}
			
		}
	}
</script>

<style>
	.visit{background: #FFFFFF;padding-bottom: 50upx;}
</style>
